package com.intelligent.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 收款单信息表
 * @TableName receipt_order
 */
@TableName(value ="receipt_order")
@Data
public class ReceiptOrder implements Serializable {
    /**
     * 自增主键
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 收款单号
     */
    private String receiptOrderNo;

    /**
     * 收款状态(0 待核销 1 部分核销 2 全部核销)
     */
    private Integer receiptStatus;

    /**
     * 客户（名称 + 编码）
     */
    private Long customerId;

    /**
     * 关联销售单
     */
    private String relatedSalesOrder;

    /**
     * 应收总额
     */
    private BigDecimal receivableAmount;

    /**
     * 已核销金额
     */
    private BigDecimal writtenOffAmount;

    /**
     * 待核销金额
     */
    private BigDecimal toBeWrittenOff;

    /**
     * 财务人员
     */
    private Integer uId;

    /**
     * 创建日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")

    private Date creationDate;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ReceiptOrder other = (ReceiptOrder) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getReceiptOrderNo() == null ? other.getReceiptOrderNo() == null : this.getReceiptOrderNo().equals(other.getReceiptOrderNo()))
            && (this.getReceiptStatus() == null ? other.getReceiptStatus() == null : this.getReceiptStatus().equals(other.getReceiptStatus()))
            && (this.getCustomerId() == null ? other.getCustomerId() == null : this.getCustomerId().equals(other.getCustomerId()))
            && (this.getRelatedSalesOrder() == null ? other.getRelatedSalesOrder() == null : this.getRelatedSalesOrder().equals(other.getRelatedSalesOrder()))
            && (this.getReceivableAmount() == null ? other.getReceivableAmount() == null : this.getReceivableAmount().equals(other.getReceivableAmount()))
            && (this.getWrittenOffAmount() == null ? other.getWrittenOffAmount() == null : this.getWrittenOffAmount().equals(other.getWrittenOffAmount()))
            && (this.getToBeWrittenOff() == null ? other.getToBeWrittenOff() == null : this.getToBeWrittenOff().equals(other.getToBeWrittenOff()))
            && (this.getUId() == null ? other.getUId() == null : this.getUId().equals(other.getUId()))
            && (this.getCreationDate() == null ? other.getCreationDate() == null : this.getCreationDate().equals(other.getCreationDate()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getReceiptOrderNo() == null) ? 0 : getReceiptOrderNo().hashCode());
        result = prime * result + ((getReceiptStatus() == null) ? 0 : getReceiptStatus().hashCode());
        result = prime * result + ((getCustomerId() == null) ? 0 : getCustomerId().hashCode());
        result = prime * result + ((getRelatedSalesOrder() == null) ? 0 : getRelatedSalesOrder().hashCode());
        result = prime * result + ((getReceivableAmount() == null) ? 0 : getReceivableAmount().hashCode());
        result = prime * result + ((getWrittenOffAmount() == null) ? 0 : getWrittenOffAmount().hashCode());
        result = prime * result + ((getToBeWrittenOff() == null) ? 0 : getToBeWrittenOff().hashCode());
        result = prime * result + ((getUId() == null) ? 0 : getUId().hashCode());
        result = prime * result + ((getCreationDate() == null) ? 0 : getCreationDate().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", receiptOrderNo=").append(receiptOrderNo);
        sb.append(", receiptStatus=").append(receiptStatus);
        sb.append(", customerId=").append(customerId);
        sb.append(", relatedSalesOrder=").append(relatedSalesOrder);
        sb.append(", receivableAmount=").append(receivableAmount);
        sb.append(", writtenOffAmount=").append(writtenOffAmount);
        sb.append(", toBeWrittenOff=").append(toBeWrittenOff);
        sb.append(", uId=").append(uId);
        sb.append(", creationDate=").append(creationDate);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
